<?php

namespace app\servermessage\service\message;
use app\manage\service\ApiBase;

/**
 * @author:      李颖
 * @DateTime:    2017-06-08 13:43:49
 * @Description: 站内信
 */

class Message extends ApiBase
{
	
	protected $messageLogic = 'app\servermessage\logic\Message';
    protected $messageValidate = 'app\servermessage\validate\Message';
    protected $addFields = ['from_uid'=>0,'to_uid'=>[],'title'=>' ','content'=>' ','type'=>' ','orther_info'=>''];

  
    /*一对一发送站内信*/
    public function sendOneMessage(): array 
    {
        $data = $this->haveIssetReceiveData(['from_uid'=>0,'to_uid'=>0,'title'=>' ','content'=>' ','type'=>' ','orther_info'=>'']);
        return $this->oneStepRun($data, 'servermessage/message/Message/sendOneMessage', 'sendOneMessage');
    }

    /*一对多发送站内信*/
    public function sendBatchMessage(): array 
    {
    	$data = $this->haveIssetReceiveData(['from_uid'=>0,'to_uid'=>[],'title'=>' ','content'=>' ','type'=>' ','orther_info'=>'']);
        return $this->oneStepRun($data, 'servermessage/message/Message/sendBatchMessage', 'sendBatchMessage');
    }

    /*管理员查看某站内信详情*/
    public function adminMessageDetail(): array 
    {
        $data = $this->receiveData(['id'=>0]);
        return $this->oneStepRun($data, 'servermessage/message/Message/adminMessageDetail', 'adminMessageDetail');
    }

     /*查看某用户的收件箱、发件箱*/
    public function adminMessageList(): array 
    {
        $data = $this->haveIssetReceiveData(['user_id'=>'','page'=>1,'listRows'=>15,'keywords'=>'']);
        return $this->oneStepRun($data, 'servermessage/message/Message/adminMessageList', 'adminMessageList');
    }

    /*回复某个站内信*/
    public function replyOneMessage(): array 
    {
        //ortherInfo:{"from_user_name":"","to_user_name":""}
        $data = $this->haveIssetReceiveData(['id'=>0,'user_id'=>0,'content'=>' ','orther_info'=>'']);  
        return $this->oneStepRun($data, 'servermessage/message/Message/replyOneMessage', 'replyOneMessage');
    }
    
    /*管理员删除某个站内信*/
    public function adminDelOneMessage(): array 
    {
        $data = $this->receiveData(['id'=>0]);
        return $this->oneStepRun($data, 'servermessage/message/Message/adminDelOneMessage', 'adminDelOneMessage');
    }

    /*管理员批量删除某个站内信*/
    public function adminDelBatchMessage(): array 
    {
        $data = $this->receiveData(['id'=>[]]);
        return $this->oneStepRun($data, 'servermessage/message/Message/adminDelBatchMessage', 'adminDelBatchMessage');
    }
}






